<SCRIPT type="text/javascript">
	function checkMe(lblLbl) {
		var theLbl = document.getElementById("id" + lblLbl);
		var theId = eval("document.frmSchedView.chk" + lblLbl);
		if (theId[0]){
			for (i = 0; i < theId.length; ++ i) {
				theId[i].checked = theLbl.checked;
			}
		} else {
			theId.checked = theLbl.checked;
		}
	}
	function verifydelete(sMessage,sAlert) {
		var x="false";
		var itemvalue="";
		for(var i=0; i <= (document.frmSchedView.chkPID.length - 1); i++){
			if (document.frmSchedView.chkPID[i].checked){
				itemvalue = itemvalue + document.frmSchedView.chkPID[i].value + "\n";
				x="true";
			}		
		}
		if (x=="true")
			return confirmThis(sMessage + "\n" + itemvalue);
		else if (x=="false")
			{
			alert (sAlert);
			return false;
			}
		else 
			return true;
	}
</script>

<CFQUERY NAME="getPowerUser" DATASOURCE="#client.company_dsn#">
	SELECT A.PERSONNELIDNO, B.LASTNAME,B.FIRSTNAME
	FROM CINWSPOWERUSER A, CMFPA B
	WHERE A.PERSONNELIDNO=B.PERSONNELIDNO
</CFQUERY>
<CFOUTPUT>

	<FORM ACTION="index.cfm?powermast=" METHOD="post" NAME="frmSchedView">

	<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TITLE="Power Users">
		<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=2 WIDTH="100%">
			<TR BGCOLOR="#client.color_tblhead#">
				<TD colspan=5>
					<INPUT TYPE="SUBMIT" NAME="btnAddEmployee" VALUE = "Add Power User" CLASS="bitbtn">&nbsp;
					
					<CFIF getPowerUser.RECORDCOUNT>
						<INPUT TYPE="SUBMIT" NAME="btnDeleteEmployee" VALUE = "Delete Selected Employees" CLASS="bitbtn"  ONCLICK="return verifydelete('Remove the selected employees:','Please select an employee to remove.')">&nbsp;
						<INPUT TYPE="SUBMIT" NAME="btnfilter" VALUE = "Add Filter" CLASS="bitbtn">&nbsp;
					</CFIF>
					<INPUT CLASS="bitbtn" TYPE="submit" NAME="btnBackAction" VALUE="Back">
				</TD>
			<TR>
			<CFIF getPowerUser.RECORDCOUNT>
				<TR ALIGN="CENTER" BGCOLOR="#client.color_tblhead#" CLASS="boldwhite11">
					<TD><CFIF getPowerUser.recordcount GT 0><INPUT TYPE="checkbox" NAME="lblPID" id="idPID" label="" onClick="javascript:checkMe('PID')"></CFIF></TD>
					<!---<TD>&nbsp;</TD>--->
					<TD>Person ID</TD>					
					<TD>First Name</TD>
					<TD>Last Name</TD>
				<TR>
				<CFSET rowCounter=0>
				<INPUT TYPE="hidden" NAME="chkPID" VALUE="">
				<CFLOOP QUERY="getPowerUser">
					<CFQUERY NAME="getFilter" DATASOURCE="#client.company_dsn#">
						SELECT DESCRIPTION
						FROM ECRGUSERFILTER
						WHERE FORMCODE = 'powerWSUser'
							AND USERFILTERID = '#PERSONNELIDNO#'
					</CFQUERY>
					<CFSET theFilterID=urlEncodedFormat(encrypt(PERSONNELIDNO, client.ek))>
					<TR BGCOLOR="#IIf(rowCounter Mod 2, "client.color_tblset1", "client.color_tblset2")#" >
						<TD ALIGN="CENTER"><INPUT TYPE="checkbox" NAME="chkPID" VALUE="#PERSONNELIDNO#"</TD>
					<!---	<TD ALIGN="CENTER">filter</TD>--->
						<TD>#PERSONNELIDNO# <CFIF getFilter.RECORDCOUNT><A CLASS="regular11" HREF="#GetFileFromPath(getBaseTemplatePath())#?type=USERDEFINED&id=#URLEncodedFormat(encrypt('powerWSUser', client.ek))#&idDet=#theFilterID#&action=editfilter&powermast=">(show filter)</a></CFIF></TD>					
						<TD>#LASTNAME#</TD>
						<TD>#FIRSTNAME#</TD>
					</TR>
					<CFSET rowCounter=rowCounter+1>
				</CFLOOP>	
			<CFELSE>
			<TR>
				<TD align="center"><b>No Records Found</b></TD>
			</TR>
			</CFIF>
			<TR BGCOLOR="#client.color_tblhead#">
				<TD class="boldwhite" COLSPAN=5>&nbsp;&nbsp;#getPowerUser.RECORDCOUNT# record/s found</TD>
			<TR>
		</TABLE>
	<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TOP="False">
</CFOUTPUT>

<CFIF isDefined("form.btnfilter") OR (ISDEFINED("URL.ACTION") AND URL.ACTION eq "EDITFILTER") AND NOT (ISDEFINED("FORM.btnUserFilterSave") OR ISDEFINED("FORM.btnUserFilterBack"))>
	<CFINCLUDE TEMPLATE="../common/_userfilterinterface.cfm">
</CFIF>

</FORM>
